/**
 * Created by Jay on 2016/6/29.
 */
function show_push_mess(){
    /*批量删除 S*/
    var judge_check=0;
    $("#del_all").on('click',function(){
        console.log("dededeedeedededededeedededededed");
        var del_list="";
        for(var i=1;i<$("input[type='checkbox']").length;i++){
           if($("input[type='checkbox']").eq(i).prop("checked")==true){
               judge_check=1;
               del_list+=$("input[type='checkbox']").eq(i).attr("data-id")+",";
           }
        }
        if(judge_check==0){
           layer.alert("请选择需要删除的消息");
            return
        }
        console.log("del_list_+_+_+_+_+"+del_list);
        delete_tips({
            url:"messageController/batchDelReciveQuestion",
            method:"POST",
            content:"确认要批量删除？",
            data:{ids:del_list},
            alert:"删除成功",
            alert_error:"删除失败"
        })
    })
    /*批量删除 E*/

    mccmsa.ajax({
        url: "messageController/showAllReceiveQuestion",
        method: "get",
        data: {pageSize: 10, pageNo: 1},
        success: function (data) {
            wrap_f(data);
        }
    })


  function  wrap_f(data){
      var prepageSize = data.result.pageSize;
      //console.log(data);
      //sessionStorage.setItem("this_page_click_num",1);//初始化为1；
      //sessionStorage.setItem("create_num", 1);//初始化为1
      set_seqsum(
          {
              pageNo: data.result.resultList.pageNo,
              pageSize: data.result.resultList.pageSize
          }
      );
      create_page({
          url: "messageController/showAllReceiveQuestion",
          method: "get",
          data: data,
          temp: "getColumnTableData_push_mess",
          contain: "#ColumnTableData_push_mess",
          prePageSize: data.result.resultList.pageSize,
          prepageNo: data.result.resultList.pageNo
      })//生成分页

      mccmsa.getHtmlFromLocalTemplate({   //将数据打包到模版丢进容器 都打成包了QAQ 是人不是。。
          templateId: "getColumnTableData_push_mess",
          container: $("#ColumnTableData_push_mess"),
          data: data,
          callback:function(){
              $("body").off();
              $("body").on("click",".push_delete",function(){
                  var id=$(this).attr("data-id");
                  delete_tips({
                      url:"messageController/delReciveQuestion?id="+id,
                      method:"get",
                      content:"确认要删除？",
                      data:{pageSize: 10, pageNo: 1},
                      alert:"删除成功",
                      alert_error:"删除失败"
                  })
              })
              /*checkbox all s*/
              var check_all=1;
              $("#check_all").on("click",function() {
                  var check=this.getAttribute("checked");
                  if(!$("#check_all").prop("checked")){//如果 第一个checkbox 是已经点了的
                      for(var i=0;i<$("input[type='checkbox']").length;i++){
                          $("input[type='checkbox']").eq(i).prop("checked",false)
                      }
                      return;
                  }
                  for(var i=0;i<$("input[type='checkbox']").length;i++){
                      $("input[type='checkbox']").eq(i).prop("checked", true);
                  }
              })
              /*checkbox all E*/
              /*single clcik checkbox S*/
              for(var j=1;j<$("input[type='checkbox']").length;j++){
                  $("input[type='checkbox']").eq(j).on('click',function(){
                      console.log("ccccccccccccccccccccccc")
                      for(var i=1;i<$("input[type='checkbox']").length;i++){
                          console.log("ffffffffffffffffffffffff")
                          if($("input[type='checkbox']").eq(i).prop("checked")==false){
                              check_all=0
                              console.log("00000000000000000")
                          }
                      }
                      check_all==0?$("input[type='checkbox']").eq(0).prop("checked",false):"";
                  })
              }
              /*single click checkbox E*/

          }
      })
  }
}